// axios 二次封装
import axios from 'axios'

const instance = axios.create({
    baseURL: '/',  //使用 mockjs 需要将 baseURL 书写为 /
    timeout: 60000,
});

export function ajax(options) {
    const { url, methods = 'get', data = {} } = options

    if (methods.toUpperCase() === 'GET') {
        return instance.get(url, { params: data })
    } else {
        return instance.post(url, data)
    }

}